package cn.ccenjie.wsy.social.github.connet;

import cn.ccenjie.wsy.social.github.api.Github;
import cn.ccenjie.wsy.social.github.api.GithubInfo;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;

public class GithubAdapter implements ApiAdapter<Github> {

    @Override
    public boolean test(Github github) {
        return true;
    }

    @Override
    public void setConnectionValues(Github github, ConnectionValues connectionValues) {
        GithubInfo info = github.info();
        connectionValues.setProviderUserId(info.getId());
        connectionValues.setImageUrl(info.getAvatar_url());
        connectionValues.setDisplayName(info.getLogin());
    }

    @Override
    public UserProfile fetchUserProfile(Github github) {
        return null;
    }

    @Override
    public void updateStatus(Github github, String s) {

    }
}
